$(document).ready(function(){
//	柱状
	$('#myChart1').attr({'width':$(window).width()});
	function drawBar(){
		Chart.defaults.global.hover.mode = 'single';
		var ctx = document.getElementById("myChart1");
		var data={
		    type: 'bar',
		    data: {
		       labels: ["星期一", "星期二", "星期三", "星期四", "星期六", "星期日"],
		        datasets: [
		        {
		            label: "My First dataset",
		            backgroundColor: [
		                'rgba(255, 99, 132, 0.2)',
		                'rgba(54, 162, 235, 0.2)',
		                'rgba(255, 206, 86, 0.2)',
		                'rgba(75, 192, 192, 0.2)',
		                'rgba(153, 102, 255, 0.2)',
		                'rgba(255, 159, 64, 0.2)'
		            ],
		            borderColor: [
		                'rgba(255,99,132,1)',
		                'rgba(54, 162, 235, 1)',
		                'rgba(255, 206, 86, 1)',
		                'rgba(75, 192, 192, 1)',
		                'rgba(153, 102, 255, 1)',
		                'rgba(255, 159, 64, 1)'
		            ],
		            borderWidth: 1,
		            data: [45, 59, 50, 60, 70, 80],
		        }
		    ]
		    }
		}
		var myChart = new Chart(ctx, data);
	}
//	饼状
	function drawPie(){
		Chart.defaults.global.hover.mode = 'single';
		var ctx = document.getElementById("myChart2");
		var data={
		    type: 'pie',
		    data: {
		       labels: ["January", "February", "March", "April", "May", "June", "July"],
		        datasets: [
		        {
		            label: "My First dataset",
		            backgroundColor: [
		                'rgba(255, 99, 132, 0.2)',
		                'rgba(54, 162, 235, 0.2)',
		                'rgba(255, 206, 86, 0.2)',
		                'rgba(75, 192, 192, 0.2)',
		                'rgba(153, 102, 255, 0.2)',
		                'rgba(255, 159, 64, 0.2)'
		            ],
		            borderColor: [
		                'rgba(255,99,132,1)',
		                'rgba(54, 162, 235, 1)',
		                'rgba(255, 206, 86, 1)',
		                'rgba(75, 192, 192, 1)',
		                'rgba(153, 102, 255, 1)',
		                'rgba(255, 159, 64, 1)'
		            ],
		            borderWidth: 1,
		            data: [45, 59, 50, 60, 70, 80],
		        }
		    ]
		    }
		}
		var myChart = new Chart(ctx, data);
	}
	
	
	$('#manage-4').click(function(){
		drawBar();
		drawPie();
	});
	
drawBar();
drawPie();
});